const CompressionPlugin = require("compression-webpack-plugin");

const { defineConfig } = require("@vue/cli-service");
module.exports = defineConfig({
  transpileDependencies: true,
  configureWebpack: {
    plugins: [
      new CompressionPlugin({
        filename: "[path][base].gz", // 压缩后的文件名(保持原文件名，后缀加.gz)
        algorithm: "gzip", // 使用gzip压缩
        test: /\.js$|\.html$|\.css$/, // 匹配文件名
        threshold: 10240, // 对超过10k的数据压缩
        minRatio: 1, // 压缩率小于0.8才会压缩
        deleteOriginalAssets: false,
      }),
    ],
  },
});
